#include<iostream>
#include<stdio.h>
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
int Day[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int a,b,c;
bool check_date(int i)
{
    int day=i%100;
    int year=i/10000;
    int month=i%10000/100;
    if(month<=0||month>13)return false;
    if((month!=2&&day>Day[month])||day<=0)return false;
    if(month==2)
    {
        if(year%4==0&&year%100!=0||year%400==0)
        {
            if(day>29)return false;
        }
        else {
            if(day>28)return false;
        }
    }
    return true;
}
int main()
{
    
    scanf("%d/%d/%d",&a,&b,&c);
    for(int i=19600101;i<=20591231;i++)
    {
        
        if(check_date(i))
        {
            int day=i%100;
            int year=i/10000;
            int month=i%10000/100;
            if(day==c&&year%100==a&&month==b||
                month==a&&day==b&&year%100==c||
                day==a&&month==b&&year%100==c)
                printf("%d-%02d-%02d\n",year,month,day);
        }
    }
    return 0;
}